﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace CardControlLibrary
{
    public class CardModel
    {
        public string Title { get; set; }
        public string WebSite { get; set; }
        public Image Face { get; set; }
        public string Description { get; set; }
        public bool Collapsed { get; set; }
        public string Category { get; set; }

        public CardModel(CardGroupModel gm)
        {
            gm.AddCard(this);
            Collapsed = true;
        }

        public delegate void AddToDocumentHandler(CardModel cm);
        public event AddToDocumentHandler OnAddToDocument;
        protected void OnAddToDocumentHandler(CardModel cm)
        {
            if (OnAddToDocument != null)
            {
                OnAddToDocument(this);
            }
        }
        public void AddToDocument()
        {
            OnAddToDocumentHandler(this);
        }
    }

    public class CardGroupModel : IComparable
    {

        public CardGroupModel()
        {
            m_CardList = new List<CardModel>(); 
        }

        private System.Collections.Generic.List<CardModel> m_CardList;
        public void AddCard(CardModel cm)
        {
            m_CardList.Add(cm);
        }
        public void ClearAllCards()
        {
            m_CardList.Clear(); 
        }
        public List<CardModel> GetCards { get { return m_CardList; } }

        public string Title { get; set; }

        #region IComparable Members

        public int CompareTo(object obj)
        {
            CardGroupModel model = (CardGroupModel)obj;
            return this.Title.CompareTo(model.Title);
            //throw new NotImplementedException();
        }

        #endregion
    }
}
